<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>ajax</title>
</head>
<body>
	<div id="ajaxzhanshi"></div>
</body>
<script type="text/javascript">
	window.onload=function(){
	var xhr = new XMLHttpRequest();
	
	xhr.open("GET","ajax.json",true);
	xhr.send(null);
	xhr.onreadystatechange=function(){
		console.log(xhr.status);
		if(xhr.readyState == 4 && xhr.status == 0){
			console.log(JSON.parse(xhr.responseText));
			document.getElementById("ajaxzhanshi").innerHTML=JSON.parse(xhr.responseText).name;
		}
	}
	
}
</script>
</html>